.class public Lcom/brixd/niceapp/service/UserService;
.super Ljava/lang/Object;
.source "UserService.java"


# static fields
.field private static mContext:Landroid/content/Context;

.field private static mInstance:Lcom/brixd/niceapp/service/UserService;


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .registers 2
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 37
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 38
    sput-object p1, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    .line 39
    return-void
.end method

.method static synthetic access$000()Landroid/content/Context;
    .registers 1

    .prologue
    .line 32
    sget-object v0, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method public static addDownId(ILcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)V
    .registers 3
    .param p0, "id"    # I
    .param p1, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 150
    invoke-static {p1}, Lcom/brixd/niceapp/service/UserService;->getDownKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0}, Lcom/brixd/niceapp/service/UserService;->addStaticsId(ILjava/lang/String;)V

    .line 151
    invoke-static {p0, p1}, Lcom/brixd/niceapp/service/UserService;->removeUpId(ILcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)V

    .line 152
    return-void
.end method

.method public static addFavId(ILcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)V
    .registers 3
    .param p0, "id"    # I
    .param p1, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 133
    invoke-static {p1}, Lcom/brixd/niceapp/service/UserService;->getFavKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0}, Lcom/brixd/niceapp/service/UserService;->addStaticsId(ILjava/lang/String;)V

    .line 134
    return-void
.end method

.method private static addStaticsId(ILjava/lang/String;)V
    .registers 10
    .param p0, "id"    # I
    .param p1, "key"    # Ljava/lang/String;

    .prologue
    .line 228
    sget-object v5, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v5}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v5

    const-string v6, "UserTrackJson"

    const-string v7, ""

    invoke-virtual {v5, v6, v7}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getPref(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    .line 229
    .local v4, "jsonDataStr":Ljava/lang/String;
    const-string v5, ""

    invoke-virtual {v5, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-eqz v5, :cond_17

    .line 248
    :cond_16
    :goto_16
    return-void

    .line 234
    :cond_17
    :try_start_17
    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3, v4}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 235
    .local v3, "jsonData":Lorg/json/JSONObject;
    invoke-virtual {v3, p1}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v2

    .line 238
    .local v2, "jsonArray":Lorg/json/JSONArray;
    const/4 v1, 0x0

    .local v1, "i":I
    :goto_21
    invoke-virtual {v2}, Lorg/json/JSONArray;->length()I

    move-result v5

    if-ge v1, v5, :cond_47

    .line 239
    invoke-virtual {v2, v1}, Lorg/json/JSONArray;->optString(I)Ljava/lang/String;

    move-result-object v5

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v6, p0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, ""

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-nez v5, :cond_16

    .line 238
    add-int/lit8 v1, v1, 0x1

    goto :goto_21

    .line 243
    :cond_47
    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v5, p0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string v6, ""

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v2, v5}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;

    .line 244
    invoke-static {v3}, Lcom/brixd/niceapp/service/UserService;->saveUserTrackModel(Lorg/json/JSONObject;)V
    :try_end_60
    .catch Ljava/lang/Exception; {:try_start_17 .. :try_end_60} :catch_61

    goto :goto_16

    .line 245
    .end local v1    # "i":I
    .end local v2    # "jsonArray":Lorg/json/JSONArray;
    .end local v3    # "jsonData":Lorg/json/JSONObject;
    :catch_61
    move-exception v0

    .line 246
    .local v0, "e":Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_16
.end method

.method public static addUpId(ILcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)V
    .registers 3
    .param p0, "id"    # I
    .param p1, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 141
    invoke-static {p1}, Lcom/brixd/niceapp/service/UserService;->getUpKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0}, Lcom/brixd/niceapp/service/UserService;->addStaticsId(ILjava/lang/String;)V

    .line 142
    invoke-static {p0, p1}, Lcom/brixd/niceapp/service/UserService;->removeDownId(ILcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)V

    .line 143
    return-void
.end method

.method public static checkMessages(Lcom/brixd/niceapp/model/UserModel;)V
    .registers 11
    .param p0, "userModel"    # Lcom/brixd/niceapp/model/UserModel;

    .prologue
    .line 327
    invoke-virtual {p0}, Lcom/brixd/niceapp/model/UserModel;->getUid()I

    move-result v1

    invoke-static {v1}, Lcom/brixd/niceapp/util/SecrUtils;->makeToken(I)Lcom/brixd/niceapp/model/Token;

    move-result-object v9

    .line 328
    .local v9, "token":Lcom/brixd/niceapp/model/Token;
    sget-object v1, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v1}, Lcom/brixd/niceapp/service/adapter/ReqRestAdapter;->niceAppAdapter(Landroid/content/Context;)Lretrofit/RestAdapter;

    move-result-object v1

    const-class v2, Lcom/brixd/niceapp/service/restful/UserRestfulRequest;

    invoke-virtual {v1, v2}, Lretrofit/RestAdapter;->create(Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/service/restful/UserRestfulRequest;

    .line 329
    .local v0, "request":Lcom/brixd/niceapp/service/restful/UserRestfulRequest;
    invoke-virtual {p0}, Lcom/brixd/niceapp/model/UserModel;->getUid()I

    move-result v1

    invoke-static {v1}, Lcom/brixd/niceapp/util/LocalCacheUtils;->getMessageLastCheckTime(I)J

    move-result-wide v1

    const/4 v3, 0x2

    invoke-virtual {v9}, Lcom/brixd/niceapp/model/Token;->getTimestamp()J

    move-result-wide v4

    invoke-virtual {v9}, Lcom/brixd/niceapp/model/Token;->getUid()I

    move-result v6

    invoke-virtual {v9}, Lcom/brixd/niceapp/model/Token;->getSecr()Ljava/lang/String;

    move-result-object v7

    new-instance v8, Lcom/brixd/niceapp/service/UserService$2;

    invoke-direct {v8, p0}, Lcom/brixd/niceapp/service/UserService$2;-><init>(Lcom/brixd/niceapp/model/UserModel;)V

    invoke-interface/range {v0 .. v8}, Lcom/brixd/niceapp/service/restful/UserRestfulRequest;->checkMessages(JIJILjava/lang/String;Lretrofit/Callback;)V

    .line 346
    return-void
.end method

.method public static getCurrentUserBg()I
    .registers 7

    .prologue
    const v6, 0x7f08002a

    .line 78
    invoke-static {}, Lcom/brixd/niceapp/service/UserService;->getLoginUser()Lcom/brixd/niceapp/model/UserModel;

    move-result-object v2

    .line 79
    .local v2, "userModel":Lcom/brixd/niceapp/model/UserModel;
    if-nez v2, :cond_14

    .line 80
    sget-object v3, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v3

    invoke-virtual {v3, v6}, Landroid/content/res/Resources;->getColor(I)I

    move-result v0

    .line 90
    :cond_13
    :goto_13
    return v0

    .line 82
    :cond_14
    sget-object v3, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v3}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v3

    const-string v4, "LoginUserBg"

    const/4 v5, 0x0

    invoke-virtual {v3, v4, v5}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getPref(Ljava/lang/String;I)I

    move-result v0

    .line 83
    .local v0, "bgColor":I
    if-nez v0, :cond_13

    .line 85
    :try_start_23
    invoke-virtual {v2}, Lcom/brixd/niceapp/model/UserModel;->getBgColor()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I
    :try_end_2a
    .catch Ljava/lang/Exception; {:try_start_23 .. :try_end_2a} :catch_2c

    move-result v0

    goto :goto_13

    .line 86
    :catch_2c
    move-exception v1

    .line 87
    .local v1, "e":Ljava/lang/Exception;
    sget-object v3, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v3

    invoke-virtual {v3, v6}, Landroid/content/res/Resources;->getColor(I)I

    move-result v0

    goto :goto_13
.end method

.method public static getDownKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;
    .registers 4
    .param p0, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 205
    const-string v0, ""

    .line 207
    .local v0, "key":Ljava/lang/String;
    sget-object v1, Lcom/brixd/niceapp/service/UserService$3;->$SwitchMap$com$brixd$niceapp$model$UserTrackModel$UserTrackModelType:[I

    invoke-virtual {p0}, Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;->ordinal()I

    move-result v2

    aget v1, v1, v2

    packed-switch v1, :pswitch_data_18

    .line 224
    :goto_d
    return-object v0

    .line 209
    :pswitch_e
    const-string v0, "app_down_history"

    .line 210
    goto :goto_d

    .line 213
    :pswitch_11
    const-string v0, "nincegoods_down_history"

    .line 214
    goto :goto_d

    .line 217
    :pswitch_14
    const-string v0, "community_down_history"

    .line 218
    goto :goto_d

    .line 207
    nop

    :pswitch_data_18
    .packed-switch 0x1
        :pswitch_e
        :pswitch_11
        :pswitch_14
    .end packed-switch
.end method

.method public static getFavKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;
    .registers 4
    .param p0, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 159
    const-string v0, ""

    .line 161
    .local v0, "key":Ljava/lang/String;
    sget-object v1, Lcom/brixd/niceapp/service/UserService$3;->$SwitchMap$com$brixd$niceapp$model$UserTrackModel$UserTrackModelType:[I

    invoke-virtual {p0}, Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;->ordinal()I

    move-result v2

    aget v1, v1, v2

    packed-switch v1, :pswitch_data_18

    .line 178
    :goto_d
    return-object v0

    .line 163
    :pswitch_e
    const-string v0, "app_fav_history"

    .line 164
    goto :goto_d

    .line 167
    :pswitch_11
    const-string v0, "nincegoods_fav_history"

    .line 168
    goto :goto_d

    .line 171
    :pswitch_14
    const-string v0, "community_fav_history"

    .line 172
    goto :goto_d

    .line 161
    nop

    :pswitch_data_18
    .packed-switch 0x1
        :pswitch_e
        :pswitch_11
        :pswitch_14
    .end packed-switch
.end method

.method public static getLoginUser()Lcom/brixd/niceapp/model/UserModel;
    .registers 6

    .prologue
    const/4 v2, 0x0

    .line 61
    sget-object v3, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v3}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v3

    const-string v4, "UserInfoJson"

    const-string v5, ""

    invoke-virtual {v3, v4, v5}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getPref(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 62
    .local v1, "jsonData":Ljava/lang/String;
    const-string v3, ""

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_18

    .line 68
    :goto_17
    return-object v2

    .line 66
    :cond_18
    :try_start_18
    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3, v1}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    invoke-static {v3}, Lcom/brixd/niceapp/model/UserModel;->parseUserModel(Lorg/json/JSONObject;)Lcom/brixd/niceapp/model/UserModel;
    :try_end_20
    .catch Lorg/json/JSONException; {:try_start_18 .. :try_end_20} :catch_22

    move-result-object v2

    goto :goto_17

    .line 67
    :catch_22
    move-exception v0

    .line 68
    .local v0, "e":Lorg/json/JSONException;
    goto :goto_17
.end method

.method public static getLoginUserId()I
    .registers 2

    .prologue
    .line 103
    invoke-static {}, Lcom/brixd/niceapp/service/UserService;->getLoginUser()Lcom/brixd/niceapp/model/UserModel;

    move-result-object v0

    .line 104
    .local v0, "userModel":Lcom/brixd/niceapp/model/UserModel;
    if-nez v0, :cond_8

    .line 105
    const/4 v1, 0x0

    .line 107
    :goto_7
    return v1

    :cond_8
    invoke-virtual {v0}, Lcom/brixd/niceapp/model/UserModel;->getUid()I

    move-result v1

    goto :goto_7
.end method

.method public static getUpKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;
    .registers 4
    .param p0, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 182
    const-string v0, ""

    .line 184
    .local v0, "key":Ljava/lang/String;
    sget-object v1, Lcom/brixd/niceapp/service/UserService$3;->$SwitchMap$com$brixd$niceapp$model$UserTrackModel$UserTrackModelType:[I

    invoke-virtual {p0}, Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;->ordinal()I

    move-result v2

    aget v1, v1, v2

    packed-switch v1, :pswitch_data_18

    .line 201
    :goto_d
    return-object v0

    .line 186
    :pswitch_e
    const-string v0, "app_up_history"

    .line 187
    goto :goto_d

    .line 190
    :pswitch_11
    const-string v0, "nincegoods_up_history"

    .line 191
    goto :goto_d

    .line 194
    :pswitch_14
    const-string v0, "community_up_history"

    .line 195
    goto :goto_d

    .line 184
    nop

    :pswitch_data_18
    .packed-switch 0x1
        :pswitch_e
        :pswitch_11
        :pswitch_14
    .end packed-switch
.end method

.method public static getUserTrackModel(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Lcom/brixd/niceapp/model/UserTrackModel;
    .registers 7
    .param p0, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 112
    sget-object v3, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v3}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v3

    const-string v4, "UserTrackJson"

    const-string v5, ""

    invoke-virtual {v3, v4, v5}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getPref(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 114
    .local v2, "jsonDataStr":Ljava/lang/String;
    const-string v3, ""

    invoke-virtual {v3, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_1e

    .line 115
    invoke-static {}, Lcom/brixd/niceapp/service/UserService;->initEmptyUserTrackJson()Lorg/json/JSONObject;

    move-result-object v3

    invoke-virtual {v3}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v2

    .line 119
    :cond_1e
    :try_start_1e
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1, v2}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 120
    .local v1, "jsonData":Lorg/json/JSONObject;
    invoke-static {v1, p0}, Lcom/brixd/niceapp/model/UserTrackModel;->parseUserTrackModel(Lorg/json/JSONObject;Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Lcom/brixd/niceapp/model/UserTrackModel;
    :try_end_26
    .catch Lorg/json/JSONException; {:try_start_1e .. :try_end_26} :catch_28

    move-result-object v3

    .line 123
    .end local v1    # "jsonData":Lorg/json/JSONObject;
    :goto_27
    return-object v3

    .line 121
    :catch_28
    move-exception v0

    .line 122
    .local v0, "e":Lorg/json/JSONException;
    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    .line 123
    const/4 v3, 0x0

    goto :goto_27
.end method

.method public static initEmptyUserTrackJson()Lorg/json/JSONObject;
    .registers 4

    .prologue
    .line 303
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1}, Lorg/json/JSONObject;-><init>()V

    .line 305
    .local v1, "jsonObject":Lorg/json/JSONObject;
    :try_start_5
    const-string v2, "app_fav_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 306
    const-string v2, "app_up_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 307
    const-string v2, "app_down_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 309
    const-string v2, "community_fav_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 310
    const-string v2, "community_up_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 311
    const-string v2, "community_down_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 313
    const-string v2, "nincegoods_fav_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 314
    const-string v2, "nincegoods_up_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 315
    const-string v2, "nincegoods_down_history"

    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3}, Lorg/json/JSONArray;-><init>()V

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 317
    invoke-static {v1}, Lcom/brixd/niceapp/service/UserService;->saveUserTrackModel(Lorg/json/JSONObject;)V
    :try_end_62
    .catch Lorg/json/JSONException; {:try_start_5 .. :try_end_62} :catch_63

    .line 321
    .end local v1    # "jsonObject":Lorg/json/JSONObject;
    :goto_62
    return-object v1

    .line 319
    .restart local v1    # "jsonObject":Lorg/json/JSONObject;
    :catch_63
    move-exception v0

    .line 320
    .local v0, "e":Lorg/json/JSONException;
    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    .line 321
    const/4 v1, 0x0

    goto :goto_62
.end method

.method public static initialize(Landroid/content/Context;)V
    .registers 3
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 47
    sget-object v0, Lcom/brixd/niceapp/service/UserService;->mInstance:Lcom/brixd/niceapp/service/UserService;

    if-nez v0, :cond_13

    .line 48
    const-class v1, Lcom/brixd/niceapp/service/UserService;

    monitor-enter v1

    .line 49
    :try_start_7
    sget-object v0, Lcom/brixd/niceapp/service/UserService;->mInstance:Lcom/brixd/niceapp/service/UserService;

    if-nez v0, :cond_12

    .line 50
    new-instance v0, Lcom/brixd/niceapp/service/UserService;

    invoke-direct {v0, p0}, Lcom/brixd/niceapp/service/UserService;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/brixd/niceapp/service/UserService;->mInstance:Lcom/brixd/niceapp/service/UserService;

    .line 52
    :cond_12
    monitor-exit v1

    .line 54
    :cond_13
    return-void

    .line 52
    :catchall_14
    move-exception v0

    monitor-exit v1
    :try_end_16
    .catchall {:try_start_7 .. :try_end_16} :catchall_14

    throw v0
.end method

.method public static isUserLogin()Z
    .registers 1

    .prologue
    .line 99
    invoke-static {}, Lcom/brixd/niceapp/service/UserService;->getLoginUser()Lcom/brixd/niceapp/model/UserModel;

    move-result-object v0

    if-eqz v0, :cond_8

    const/4 v0, 0x1

    :goto_7
    return v0

    :cond_8
    const/4 v0, 0x0

    goto :goto_7
.end method

.method private static removeDownId(ILcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)V
    .registers 3
    .param p0, "id"    # I
    .param p1, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 155
    invoke-static {p1}, Lcom/brixd/niceapp/service/UserService;->getDownKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0}, Lcom/brixd/niceapp/service/UserService;->removeStaticsId(ILjava/lang/String;)V

    .line 156
    return-void
.end method

.method public static removeFavId(ILcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)V
    .registers 3
    .param p0, "id"    # I
    .param p1, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 137
    invoke-static {p1}, Lcom/brixd/niceapp/service/UserService;->getFavKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0}, Lcom/brixd/niceapp/service/UserService;->removeStaticsId(ILjava/lang/String;)V

    .line 138
    return-void
.end method

.method private static removeStaticsId(ILjava/lang/String;)V
    .registers 12
    .param p0, "id"    # I
    .param p1, "key"    # Ljava/lang/String;

    .prologue
    .line 251
    sget-object v7, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v7}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v7

    const-string v8, "UserTrackJson"

    const-string v9, ""

    invoke-virtual {v7, v8, v9}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getPref(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    .line 252
    .local v5, "jsonDataStr":Ljava/lang/String;
    const-string v7, ""

    invoke-virtual {v7, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_17

    .line 271
    :goto_16
    return-void

    .line 257
    :cond_17
    :try_start_17
    new-instance v4, Lorg/json/JSONObject;

    invoke-direct {v4, v5}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 258
    .local v4, "jsonData":Lorg/json/JSONObject;
    invoke-virtual {v4, p1}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v3

    .line 259
    .local v3, "jsonArray":Lorg/json/JSONArray;
    new-instance v6, Lorg/json/JSONArray;

    invoke-direct {v6}, Lorg/json/JSONArray;-><init>()V

    .line 260
    .local v6, "newFavArray":Lorg/json/JSONArray;
    const/4 v1, 0x0

    .local v1, "i":I
    :goto_26
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v7

    if-ge v1, v7, :cond_4f

    .line 261
    invoke-virtual {v3, v1}, Lorg/json/JSONArray;->optString(I)Ljava/lang/String;

    move-result-object v2

    .line 262
    .local v2, "idStr":Ljava/lang/String;
    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v7, p0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, ""

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v2, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-nez v7, :cond_4c

    .line 263
    invoke-virtual {v6, v2}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;

    .line 260
    :cond_4c
    add-int/lit8 v1, v1, 0x1

    goto :goto_26

    .line 266
    .end local v2    # "idStr":Ljava/lang/String;
    :cond_4f
    invoke-virtual {v4, p1, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 267
    invoke-static {v4}, Lcom/brixd/niceapp/service/UserService;->saveUserTrackModel(Lorg/json/JSONObject;)V
    :try_end_55
    .catch Ljava/lang/Exception; {:try_start_17 .. :try_end_55} :catch_56

    goto :goto_16

    .line 268
    .end local v1    # "i":I
    .end local v3    # "jsonArray":Lorg/json/JSONArray;
    .end local v4    # "jsonData":Lorg/json/JSONObject;
    .end local v6    # "newFavArray":Lorg/json/JSONArray;
    :catch_56
    move-exception v0

    .line 269
    .local v0, "e":Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_16
.end method

.method private static removeUpId(ILcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)V
    .registers 3
    .param p0, "id"    # I
    .param p1, "type"    # Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;

    .prologue
    .line 146
    invoke-static {p1}, Lcom/brixd/niceapp/service/UserService;->getUpKey(Lcom/brixd/niceapp/model/UserTrackModel$UserTrackModelType;)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0}, Lcom/brixd/niceapp/service/UserService;->removeStaticsId(ILjava/lang/String;)V

    .line 147
    return-void
.end method

.method public static saveUserModel(Lorg/json/JSONObject;)V
    .registers 4
    .param p0, "jsonData"    # Lorg/json/JSONObject;

    .prologue
    .line 57
    sget-object v0, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v0}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v0

    const-string v1, "UserInfoJson"

    invoke-virtual {p0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->setPref(Ljava/lang/String;Ljava/lang/String;)V

    .line 58
    return-void
.end method

.method public static saveUserTrackModel(Lorg/json/JSONObject;)V
    .registers 4
    .param p0, "jsonData"    # Lorg/json/JSONObject;

    .prologue
    .line 128
    sget-object v0, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v0}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v0

    const-string v1, "UserTrackJson"

    invoke-virtual {p0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->setPref(Ljava/lang/String;Ljava/lang/String;)V

    .line 129
    return-void
.end method

.method public static setCurrentUserBg(I)V
    .registers 3
    .param p0, "color"    # I

    .prologue
    .line 95
    sget-object v0, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v0}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v0

    const-string v1, "LoginUserBg"

    invoke-virtual {v0, v1, p0}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->setPref(Ljava/lang/String;I)V

    .line 96
    return-void
.end method

.method public static updateUserTrack(I)V
    .registers 2
    .param p0, "uid"    # I

    .prologue
    .line 274
    const/4 v0, 0x0

    invoke-static {p0, v0}, Lcom/brixd/niceapp/service/UserService;->updateUserTrack(ILretrofit/Callback;)V

    .line 275
    return-void
.end method

.method public static updateUserTrack(ILretrofit/Callback;)V
    .registers 5
    .param p0, "uid"    # I
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I",
            "Lretrofit/Callback",
            "<",
            "Lorg/json/JSONObject;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 278
    .local p1, "callback":Lretrofit/Callback;, "Lretrofit/Callback<Lorg/json/JSONObject;>;"
    sget-object v1, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v1}, Lcom/brixd/niceapp/service/adapter/ReqRestAdapter;->niceAppAdapter(Landroid/content/Context;)Lretrofit/RestAdapter;

    move-result-object v1

    const-class v2, Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;

    invoke-virtual {v1, v2}, Lretrofit/RestAdapter;->create(Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;

    .line 279
    .local v0, "request":Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;
    new-instance v1, Lcom/brixd/niceapp/service/UserService$1;

    invoke-direct {v1, p1}, Lcom/brixd/niceapp/service/UserService$1;-><init>(Lretrofit/Callback;)V

    invoke-interface {v0, p0, v1}, Lcom/brixd/niceapp/service/restful/NiceAppRestfulRequest;->queryUserTracks(ILretrofit/Callback;)V

    .line 300
    return-void
.end method

.method public static userLogout()V
    .registers 3

    .prologue
    .line 74
    sget-object v0, Lcom/brixd/niceapp/service/UserService;->mContext:Landroid/content/Context;

    invoke-static {v0}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/db/SharePrefHelper;

    move-result-object v0

    const-string v1, "UserInfoJson"

    const-string v2, ""

    invoke-virtual {v0, v1, v2}, Lcom/zuiapps/suite/utils/db/SharePrefHelper;->setPref(Ljava/lang/String;Ljava/lang/String;)V

    .line 75
    return-void
.end method
